
use "$input/yu_ash_ready", clear

* use data after 1965
keep if year >= 1965


eststo clear

eststo: reghdfe cites_pos_m_log   polar_start if rule_NP, absorb(stateyear) cluster(state year)
estimates store model12

eststo: reghdfe cites_pos_m_log   polar_start if rule_P, absorb(stateyear) cluster(state year)
estimates store model11

eststo: reghdfe cites_pos_m_log   polar_start if rule_U, absorb(stateyear) cluster(state year)
estimates store model13

eststo: reghdfe cites_pos_m_log   polar_start if rule_G, absorb(stateyear) cluster(state year)
estimates store model14


** scatter plot across four systems
binscatter cites_pos_m_log polar_start if rule_NP|rule_P|rule_U|rule_G , nquantiles(18) absorb(stateyear) by(rule_howretain) ytitle("Log Citations Per Opinion") xtitle("Voter Polarization at Judge Start Year") legend(order(1 "Governor Selection" 2 "Non-Partisan Elections" 3 "Partisan Elections" 4 "Merit System"))
graph export "$output/figures/fig4.pdf", replace

